import request from '@/utils/request';

// 查询
export function getCouponList(params) {
  return request({
    url: '/admin/scrmcoincertificatebatch/list',
    method: 'get',
    params,
  })
}

// 新增兑换券
export function addCoupon(data) {
  return request({
    url: '/admin/scrmcoincertificatebatch',
    method: 'post',
    data,
  })
}

// 新增兑换券
export function editCouponState(data) {
  return request({
    url: '/admin/scrmcoincertificatebatch',
    method: 'put',
    data,
  })
}


// 新增兑换券
export function giveCoupon(data) {
  return request({
    url: '/admin/scrmcoincertificatebatch/give',
    method: 'post',
    data,
  })
}


// 新增兑换券
export function getStaff(deptids) {
  return request({
    url: `/admin/admin/group/list/${deptids}`,
    method: 'get',

  })
}


// 兑换券详情
export function getCouponInfoList(params) {
  return request({
    url: `/admin/scrmcoincertificatebatch/detail/list`,
    method: 'get',
    params

  })
}


// 核销统计
export function userCouponList(params) {
  return request({
    url: `/admin/scrmcoincertificatebatch/use/list`,
    method: 'get',
    params

  })
}

// 供应商列表
export function getProviderList(params) {
  return request({
    url: `/admin/scrmcoincertificatebatch/certificateCm/list`,
    method: 'get',
    params
  })
}
// 批次号列表
export function getBatchNoList(params) {
  return request({
    url: `/admin/scrmcoincertificatebatch/certificateId/list`,
    method: 'get',
    params

  })
}
// 兑换卡名称
export function getCouponNameList(params) {
  return request({
    url: `/admin/scrmcoincertificatebatch/certificateName/list`,
    method: 'get',
    params

  })
}

// 兑换券数据分析
export function getAnalysisList(data) {
  return request({
    url: '/admin/scrmcoincertificatebatch/analysis/list?pageNum=' + data.pageNum + '&pageSize=' + data.pageSize,
    method: 'post',
    data,
  })
}

// 兑换券长链转短链
export function getShareLink(data){
  return request({
    url: `/admin/scrmcoincertificatebatch/share`,
    method: 'post',
    data
  })
}

// 修改核销状态
export function updateCouponCodeState(data) {
  return request({
    url: `/admin/scrmcoincertificatebatch/updateState`,
    method: 'post',
    data
  })
}

// 删除权益码
export function deleteCouponCode(params) {
  return request({
    url: `/admin/scrmcoincertificatebatch/deleteCode`,
    method: 'get',
    params
  })
}

// 查询权益总计
export function getCouponInfoSum(params) {
  return request({
    url: `/admin/scrmcoincertificatebatch/count`,
    method: 'get',
    params
  })
}
